package com.versita.shadow_sniper;

import org.hibernate.Session;

import com.versita.api.DomainAPI;
import com.versita.api.DomainAPIExtend;
import com.versita.domain.User;
import com.versita.domain.UserLocation;
import com.versita.shadow_sniper.api.Interaction;
import com.versita.shadow_sniper.domain.Weapon;
import com.versita.utils.HibernateUtil;

/**
 * 
 * This is an external API that a client of the application
 * can call.
 * 
 * @author vmc
 *
 */
public class Shadow_Game implements Interaction {
    final private DomainAPIExtend domainAPIExtend = new DomainAPIExtend();
    /**
     * 
     */
    public boolean snips(String sniperId, String weaponId, String snipeeId) {
        User sniper = null;
        Weapon weapon = null;
        User snipee = null;
        return this.snips(sniper, weapon, snipee);
    }

    /**
     * 
     */
    public boolean snips(User sniper, Weapon weapon, User snipee) {
        return false;
    }

    public long register(User user, UserLocation userLocation) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.getTransaction().begin();
        session.save(user);
        session.getTransaction().commit();
        return 0;
    }

    public long register(User user) {
        return domainAPIExtend.register(user).getUserId();
    }

}
